﻿<UserControl 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  
    x:Class="WGM_Silverlight.Views.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:localcontrols="clr-namespace:WGM_Silverlight.Controls"
    xmlns:localviews="clr-namespace:WGM_Silverlight.Views"
    Loaded="OnLoaded"
    >
    <Grid x:Name="LayoutRoot" Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="3"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="0" x:Name="_statusRow"/>
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                <Image Name="_backToLobbyBtn" Cursor="Hand" Source="../Images/back-arrow.png" ToolTipService.ToolTip="Back to main lobby" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
                <StackPanel HorizontalAlignment="Left" Margin="5,0,0,0">
                    <TextBlock Name="_currentNetworkTB" VerticalAlignment="Center" FontSize="14" HorizontalAlignment="Left" Text="Current Network" FontFamily="Verdana" Foreground="White"/>
                    <TextBlock Margin="3,0,0,0" Name="_currentNetworkDescTB" VerticalAlignment="Center" FontSize="10" HorizontalAlignment="Left" Text="Desc" FontFamily="Verdana" Foreground="White" FontStyle="Italic"/>
                </StackPanel>
            </StackPanel>
            <TextBlock FontFamily="Verdana" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="1" Text="Options" Foreground="White" Cursor="Hand" x:Name="_optionsBtn" MouseLeftButtonDown="OnOptionsClick"/>
        </Grid>
        <Rectangle Grid.Row="1" HorizontalAlignment="Stretch"  Height="1.5">
            <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                    <GradientStop Color="Transparent" Offset="0"/>
                    <GradientStop Color="White" Offset="0.5"/>
                    <GradientStop Color="Transparent" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Grid Grid.Row="2" Name="_mainControls">
            <Grid.ColumnDefinitions>
                <ColumnDefinition  MinWidth="200" Width="200"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal">
                <Border Width="45" Height="45" CornerRadius="4" >
                    <Border.Background>
                        <ImageBrush ImageSource="../Images/blank.png" x:Name="_myContactImageBrush"/>
                    </Border.Background>
                </Border>
                <StackPanel VerticalAlignment="Center">
                    <TextBlock Name="_myContactNameTb" MaxWidth="150" FontSize="14" Foreground="White" FontFamily="Verdana"/>
                    <TextBlock Name="_myContactStatusTb" MaxWidth="150" Margin="5,0,0,0" FontSize="10" Foreground="White" FontFamily="Verdana" FontStyle="Italic" />
                </StackPanel>
            </StackPanel>
            <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" x:Name="_contactScroller" VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerStyle1}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                <StackPanel Name="_contactList"  >
                </StackPanel>
            </ScrollViewer>
            <controls:GridSplitter Grid.RowSpan="2" Width="2" VerticalAlignment="Stretch" IsTabStop="False" >
                <controls:GridSplitter.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="Black" Offset="0.3"/>
                        <GradientStop Color="White" Offset="0.5"/>
                        <GradientStop Color="Black" Offset="0.7"/>
                    </LinearGradientBrush>
                </controls:GridSplitter.Background>
            </controls:GridSplitter>
            <controls:TabControl Grid.Column="1" Grid.RowSpan="2" Background="Transparent" BorderThickness="0" SelectionChanged="OnViewChanged">
                <controls:TabItem Visibility="Collapsed" IsSelected="True" Name="_chatTab">
                    <controls:TabControl Name="_chatControl"  BorderThickness="0" Background="Transparent">

                    </controls:TabControl>
                </controls:TabItem>
                <controls:TabItem x:Name="_optionsTab" Visibility="Collapsed">
                    <localviews:OptionsView x:Name="_optionsView" />
                </controls:TabItem>
            </controls:TabControl>

            <Image Grid.Row="1" Grid.Column="1" Visibility="Collapsed" Canvas.ZIndex="2"  x:Name="_unreadMessagesImage" Source="../Images/unread_messages.png" Width="100"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0.5" ToolTipService.ToolTip="You have unread messages..." Cursor="Hand" MouseLeftButtonDown="OnGoToNextUnread"/>

        </Grid>
        <Border Background="Red" Grid.Row="3">
            <TextBlock x:Name="_statusMessage"   TextAlignment="Center" Foreground="Black"  HorizontalAlignment="Stretch" Text="You are currently experiencing connection issues..." FontFamily="Verdana"/>
        </Border>

        <Border Visibility="Collapsed" CornerRadius="10" x:Name="_progressPanel" Grid.Row="2" Canvas.ZIndex="1" HorizontalAlignment="Center" VerticalAlignment="Center" Height="90" Width="250">
            <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="#CF473E3E" Offset="1"/>
                    <GradientStop Color="#CF333989" Offset="0"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid Margin="2">
                <TextBlock Foreground="White" Text="Retrieving Contact List..." x:Name="_progressMessage" TextWrapping="Wrap"/>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Name="_retyPanel" Visibility="Collapsed">
                    <localcontrols:CategoryButton Name="_retryButton" DisplayBackground="#55000000" DisplayText="Retry" DisplayTextColour="White" TransitionColor="Lime" MouseLeftButtonDown="OnRetry" Margin="2" Width="80"/>
                    <localcontrols:CategoryButton Name="_cancelButton" DisplayBackground="#55000000" DisplayText="Cancel" DisplayTextColour="White" TransitionColor="Salmon" MouseLeftButtonDown="OnCancel" Margin="2" Width="80"/>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
